home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / IniWriteSection.au3 < prev    next >
Text File  |  2007-09-08  |  955b  |  20 lines

  1. ; This is the INI file we will write to.  It will be created on the Desktop.
  2. $sIni = @DesktopDir & "\AutoIt-Test.ini"
  3.  
  4. ; Demonstrate creating a new section using a string as input.
  5. $sData = "Key1=Value1" & @LF & "Key2=Value2" & @LF & "Key3=Value3"
  6. IniWriteSection($sIni, "Section1", $sData)
  7.  
  8. ; Demonstrate creating a new section using an array as input.
  9. $aData1 = IniReadSection($sIni, "Section1")    ; Read in what we just wrote above.
  10. For $i = 1 To UBound($aData1) - 1
  11.     $aData1[$i][1] &= "-" & $i    ; Change the data some
  12. Next
  13.  
  14. IniWriteSection($sIni, "Section2", $aData1)    ; Write to a new section.
  15.  
  16. ; Demonstrate creating an array manually and using it as input.
  17. Dim $aData2[3][2] = [ [ "FirstKey", "FirstValue" ], [ "SecondKey", "SecondValue" ], [ "ThirdKey", "ThirdValue" ] ]
  18. ; Since the array we made starts at element 0, we need to tell IniWriteSection() to start writing from element 0.
  19. IniWriteSection($sIni, "Section3", $aData2, 0)
  20.